﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:Monti.Controls">

   <!-- Numeric Control Override -->
   <Style TargetType="RepeatButton" x:Key="NumericControlButtonStyle">
      <Style.Resources>
         <LinearGradientBrush x:Key="ButtonBrush" StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" Offset="0.10"/>
            <GradientStop Color="{DynamicResource {x:Static SystemColors.ControlLightColorKey}}" Offset=".80"/>
         </LinearGradientBrush>
      </Style.Resources>

      <Setter Property="HorizontalContentAlignment" Value="Center"/>
      <Setter Property="VerticalContentAlignment" Value="Center"/>

      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="RepeatButton">
               <Border 
                      x:Name="Border"  
                      CornerRadius="0" 
                      BorderThickness="1"
                      Background="{DynamicResource ButtonBrush}"
                       
                      BorderBrush="{TemplateBinding BorderBrush}">
                  <ContentPresenter 
                            Margin="2"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            RecognizesAccessKey="True"/>
               </Border>

               <ControlTemplate.Triggers>
                  <Trigger Property="IsMouseOver" Value="true">
                     <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
                  </Trigger>

                  <Trigger Property="IsPressed" Value="true">
                     <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" />
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>

         </Setter.Value>
      </Setter>
   </Style>

   <!-- Control Templates for Numeric Spinner Control-->
   <Style TargetType="{x:Type Controls:NumericUpDown}">
      <Setter Property="Height" Value="25"/>
      <Setter Property="Template">

         <Setter.Value>
            <ControlTemplate TargetType="{x:Type Controls:NumericUpDown}">
               <Border
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Height="{TemplateBinding Height}"
                            Width="{TemplateBinding Width}">
                  <DockPanel >
                     <UniformGrid Margin="0 1 0 1" Width="30" DockPanel.Dock="Right" Columns="1" >

                        <!-- Increment Button -->
                        <RepeatButton x:Name="PART_IncrementButton" Style="{StaticResource NumericControlButtonStyle}">
                           <RepeatButton.Content>
                              <Viewbox Stretch="Uniform" Margin="0 1 0 0">

                                 <Path Stroke="{x:Static SystemColors.ControlTextBrush}" StrokeThickness="8" Data="M 0,0 L 15,15 L 30,0">
                                    <Path.RenderTransform>
                                       <RotateTransform CenterX="15" CenterY="7.5" Angle="180"/>
                                    </Path.RenderTransform>
                                 </Path>
                              </Viewbox>
                           </RepeatButton.Content>
                        </RepeatButton>

                        <!-- Decrement Button -->
                        <RepeatButton x:Name="PART_DecrementButton" Style="{StaticResource NumericControlButtonStyle}" >

                           <RepeatButton.Content>
                              <Viewbox Stretch="Uniform" Margin="0 1 0 0">
                                 <Path Stroke="{x:Static SystemColors.ControlTextBrush}" StrokeThickness="8" Data="M 0,0 L 15,15 L 30,0"/>
                              </Viewbox>
                           </RepeatButton.Content>

                        </RepeatButton>
                     </UniformGrid>

                     <!-- TextBox -->
                     <TextBox x:Name="PART_NumericTextBox" Background="{TemplateBinding Background}"
                                     TextAlignment="Right" VerticalContentAlignment="Center" 
                                     Margin="0 1 0 1"  DockPanel.Dock="Left"/>
                  </DockPanel>
               </Border>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

</ResourceDictionary>